<% projects.each do |project| %>
  <% if policy(project).check_direct_view_access? %>
    <div class="col-12 col-sm-12 col-md-6 col-lg-4 users-circuits-column circuit-card-js">
      <div class="card text-center users-card">
        <div class="card-header users-card-header">
          <div class="users-card-name">
            <p><%= project.name %></p>
            <span class="tooltiptext"><%= project.name %></span>
          </div>
          <div class="users-tag-container">
            <% if !project.assignment_id.nil? %>
              <span class="badge search-tag"><%= t("assignment") %></span>
            <% end %>
            <span class="badge search-tag"><%= project.project_access_type %></span>
          </div>
        </div>
        <div class="card-body users-card-body">
          <%= image_tag(
                project.circuit_preview.attached? ? project.circuit_preview : image_path("empty_project/default.png"),
                class: "users-card-image",
                alt: project.name
              ) %>
        </div>
        <div class="card-footer users-card-footer">
          <% if policy(project).user_access? %>
            <a href="<%= simulator_edit_path(project) %>" class="btn primary-button" target="_blank"><%= t("launch") %></a>
          <% else %>
            <%= link_to create_fork_project_path(project), class: "btn primary-button", target: "_blank", method: :post, rel: "noopener" do %>
              <span><%= t("fork") %></span>
            <% end %>
          <% end %>
          <%= link_to t("view"), "#", class: "previewButton btn primary-button", data: { bs_toggle: "modal", bs_target: "#projectModal", currentproject: project } %>
          <a href="<%= user_project_path(project.author_id, project) %>" class="btn primary-button" target="_blank"><%= t("more") %></a>
        </div>
      </div>
    </div>
  <% end %>
<% end %>
